<?php

if (!defined('APP_ROOT')) define('APP_ROOT', dirname(__FILE__) . '/../../');
if (!defined('APP_INC')) define('APP_INC', APP_ROOT . '/../../inc/');
if (!defined('APP_LIB')) define('APP_LIB', APP_ROOT . '/../../lib/');

require_once(APP_ROOT . '/inc/config.php');

require_once(APP_ROOT . '/lib/tel/Cdr.class.php');

class CdrTest extends PHPUnit_Framework_TestCase {
  
	public function setUp() {
	}
	
	public function tearDown() { 
		
	}
	
	function _mp3($dst, $file) {
		if (preg_match("/([a-z]+)-(\d+)-(\d+)-(\d+)-(\d+)-([\d|.]+)(.wav)/i", $file, $m)) {
			echo '1';
		} else if (preg_match("/([A-Z]+)(\d+)-(\d+)-(\d+)-([\d|.]+)(.wav)/i", $file, $m)) {
			echo '2';
		} else if (preg_match("/(\d+)-(\d+)-([\d|.]+)(.wav)/i", $file, $m)) {
			echo '3';
		}
		
		print_r($m);
	
		return '';
	}
	
	public function testa() {
	
		$file = "exten-8037-8110-20150502-150716-1430550436.13801.wav";
		
		$this->_mp3('', $file);
		
		$ret = true;
	
		$this->assertTrue($ret);
	}
	
	public function testb() {
	
		$file = "20131209-103657-1386556617.9.wav";
	
		$this->_mp3('', $file);
	
		$ret = true;
	
		$this->assertTrue($ret);
	}
	
	public function testc() {
	
		$file = "OUT2403-20150730-080757-1438214877.23.wav";
	
		$s = $this->_mp3('', $file);
		
		echo $s;
	
		$ret = true;
	
		$this->assertTrue($ret);
	}
	
	
	
	
}
?>